package org.gvp.manager.service.impl;

import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.gvp.manager.pojo.GatewayRoute;
import org.gvp.manager.repository.GatewayRouteRepository;
import org.gvp.manager.service.GatewayRouteService;
import org.springframework.stereotype.Service;

import java.util.List;

@Log4j2
@Service
@RequiredArgsConstructor
public class GatewayRouteServiceImpl implements GatewayRouteService {
    private final GatewayRouteRepository routeRepository;
    @Override
    public List<GatewayRoute> findList() {
        log.debug("获取全部网关路由列表");
        return routeRepository.searchList();
    }

    @Override
    public int save(GatewayRoute pojo) {
        log.debug("添加路由信息: {}", pojo);
        return this.routeRepository.append(pojo);
    }

    @Override
    public int edit(GatewayRoute pojo) {
        log.debug("更新路由信息: {}", pojo);
        return this.routeRepository.modify(pojo);
    }
}
